import Vue from "vue";
import App from "./App.vue";

// 三级联动组件全局组件
import TypeNav from "@/components/TypeNav";
import Carsousel from "@/components/Carousel";
import Pagintion from "@/components/Pagintion";
import { Button, MessageBox } from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

// 第一个参数：全局组件的名字，第二个参数：那个组件
Vue.component(TypeNav.name, TypeNav);
Vue.component(Carsousel.name, Carsousel);
Vue.component(Pagintion.name, Pagintion);
Vue.component(Button.name,Button)
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

// 引入仓库
import store from "@/store";

// 引入路由
import router from "@/router";

// 引入mock数据
import "@/mock/mockServe";

// 引入swiper样式
import "swiper/css/swiper.css";

Vue.config.productionTip = false;
// 统一接口api文件里面全部请求
import * as API from "@/api";

// 懒加载插件
import VueLazyload from "vue-lazyload";
import atm from '@/assets/1.gif'
Vue.use(VueLazyload,{
  // 懒加载默认图片
  loading:atm
  
})
// 表单校验
import '@/plugins/validate'

new Vue({
  render: (h) => h(App),

  // 全局事件总线
  beforeCreate() {
    Vue.prototype.$bus = this;
    // API挂载原型对象
    Vue.prototype.$API = API;
  },

  // 注册路由
  router,
  // 注册仓库
  store,
}).$mount("#app");
